<!doctype html>

        <head>
        <meta http-equiv="content-type" content="text/html;charset=utf-8">
        <meta name="apple-mobile-web-app-capable" content="yes" />
        <meta id="vieport" name="viewport" content="width=640, initial-scale=0.5, minimum-scale=0.5, maximum-scale=0.5">
        <script type="text/javascript" src="js/jquery-1.8.0.min.js"></script>
        <script type="text/javascript" src="js/jquery.nicescroll.js"></script>
        <script type="text/javascript" src="js/jquery.cookie.js"></script>
        <script type="text/javascript" src="./js/home-jx.js?version=0310"></script>
        <script type="text/javascript" src="js/jquery.alert.js"></script>
		<link rel="stylesheet" type="text/css" href="./css/jquery.alert.css" />
        <script type="text/javascript" src="./js/base64.js"></script>
        <script type="text/javascript" src="./js/jquery.cookie.js"></script>
        <link rel="stylesheet" type="text/css" href="./css/home.css?version=0310" />
        <link rel="stylesheet" type="text/css" href="./css/common.css?version=0310" />
        <link rel="stylesheet" type="text/css" href="common.css" />
        <script type="text/javascript" src="js/common.js?version=0310"></script>
        <script language="javascript">
		var password = $.cookie('password1');
		var natureid = $.cookie('NP_INFO_ID');
		var phoneNo = $.cookie('NP_INFO_TELNO');
		var ukey = $.cookie('U_KEY');
		function xiugai(){	 
	        var url ="./userInfoAdd.html";
	        window.location.href=url;
	 
		}
		//$.cookie("name");
		//$.cookie("name",value,{path:"/",expires:7});

		//base64encode("")//编码
		//base64decode("")//解码
		
		function char_test(chr)
		//字符检测函数
		{
			var i;
			var smallch="abcdefghijklmnopqrstuvwxyz";
			var bigch="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
			for(i=0;i<26;i++)
			if(chr==smallch.charAt(i) || chr==bigch.charAt(i))
			  return(1);
			return(0);
			}
	
			function spchar_test(chr)
			//数字和特殊字符检测函数
			{
			var i;
			var spch="_-.0123456789";
			for (i=0;i<13;i++)
			  if(chr==spch.charAt(i))
			  return(1);
			return(0);
		}
		
		function email_test(str)
		{
			var i,flag=0;
			var at_symbol=0;
			//“@”检测的位置
			var dot_symbol=0;
			//“.”检测的位置
			if(char_test(str.charAt(0))==0 )
			return(1);
			//首字符必须用字母
	
			for (i=1;i<str.length;i++)
			if(str.charAt(i)=='@')
			  {
			  at_symbol=i;
			  break;
			  }
			//检测“@”的位置
	
			if(at_symbol==str.length-1 || at_symbol==0)
			return(2);
			//没有邮件服务器域名
	
			if(at_symbol<3)
			return(3);
			//帐号少于三个字符
	
			if(at_symbol>19 )
			return(4);
			//帐号多于十九个字符
	
			for(i=1;i<at_symbol;i++)
			if(char_test(str.charAt(i))==0 && spchar_test(str.charAt(i))==0)
			  return (5);
			for(i=at_symbol+1;i<str.length;i++)
			if(char_test(str.charAt(i))==0 && spchar_test(str.charAt(i))==0)
			  return (5);
			//不能用其它的特殊字符 
			 
			for(i=at_symbol+1;i<str.length;i++)
			if(str.charAt(i)=='.') dot_symbol=i;
			for(i=at_symbol+1;i<str.length;i++)
			if(dot_symbol==0 || dot_symbol==str.length-1)
			//简单的检测有没有“.”，以确定服务器名是否合法
			return (6);
			 
			return (0);
			//邮件名合法
		} 
		
		
		jQuery(document).ready(function() {
			if(versionFlag=="bj"){
				$('#diqu').hide();
			}else{
				$("#titleDesc").text("欢迎来到星火平台");
			}
			
			$('.middle2').hide();
			$('.middle3').hide();
			//var url ="./userInfoAdd.html?sign=1";
	        //window.location.href=url;

			$.natureajax({
				type: "get",
				url:jsonserver+"community_naturepwd.do?",//获取JSON
				data:"callback=?&natureid="+natureid+"&passwd="+password,
				dataType:"jsonp",
				success:function(json){
					if(json[0].result==1){
						//alert(json[1].length);
						$("#username1").append("用户：" + phoneNo);
						$("#phoneNumber").append("手机号：" + json[1][0].NP_INFO_TELNO);
						$('.middle3').show();
						$('.middle1').remove();
						//$("#home1").getNiceScroll().resize();
					}else{
						$("#phoneNumber").append("手机号：" + phoneNo);
						$("#username1").append("用户：" +  phoneNo);
						}
				},
				error:function(){
					jAlert("抱歉，出错了",'注销',function(e){});
				}
				
			});
			
			$.natureajax({
				type: "get",
				url:jsonserver+"other_queryRegionList.do?",//获取JSON
				data:"callback=?&NP_INFO_ID="+natureid,
				dataType:"jsonp",
				success:function(json){
					if(json[0].result==1){
						if(json[1].length>0){
							//地域进行遍历
							var _html='';
							for(i=0;i<json[1].length;i++){		
								var obj = json[1][i];
								if(i==0){
									_html +='<option  selected="selected"  value="'+obj.AREA_ID+'">'+obj.NAME+'</option>';
									}else{
										_html +='<option   value="'+obj.AREA_ID+'">'+obj.NAME+'</option>';
									}
							}
							$("#u48").append(_html);
						}
					}
				},
				error:function(){
					jAlert("抱歉，出错了",'注销',function(e){});
				}
				
			});

			//设置新密码
		$('.okbtn').click(function(){
			 var newpassword = base64encode($('#password').val());
			 var repassword = base64encode($('#repassword').val());
			 if(email_test($('#email').val())!=0)
			  {
				 jAlert("Email格式不正确!",'注销',function(e){});
			    return "";
			  }
			 if(newpassword.length<6)
			  {
				 jAlert("密码长度小于六位!",'注销',function(e){});
			    return "";
			  }
			var pp = $('#password').val();
			if(pp==""||$('#email').val()==""){
				 jAlert("你输入的为空！",'注销',function(e){});
			}else{
				 if(newpassword==repassword){
					 $.natureajax({
							type: "get",
							url:jsonserver+"login_setNewPassword.do?",//获取JSON
							data:"callback=?&NP_INFO_ID="+natureid+"&Ukey="+ukey+"&newPass="+newpassword+"&newPassSure="+repassword+""
							+"&NP_EMAIL="+$('#email').val()+"&NP_AREA_CODE="+$('#u48').val()+"",
							dataType:"jsonp",
							success:function(json){
								if(json[0].result==1){
									$.cookie("password1",newpassword,{path:"/",expires:15});
									$('.middle3').show();
									$('.middle1').remove();
								}else{
									jAlert("修改失败，请稍后再试",'注销',function(e){});
									}
							},
							error:function(){
								jAlert("抱歉，出错了",'注销',function(e){});
							}
							
						});
						
				 }else{
					 jAlert("两次输入的密码不一样！",'注销',function(e){});
				 }
			}

            
		 }); 
		$("#repassword").blur(function () { 
			var password = $("#password").val();
			if(this.value==password){

			}else{
				 jAlert("两次密码输入不一致",'注销',function(e){});
				}

			} );	
		$("#repassword1").blur(function () { 
			var password = $("#password1").val();
			if(this.value==password){

			}else{
				jAlert("两次密码输入不一致",'注销',function(e){});
				}

			} );	
		$("input").focus(function(){
			if(this.value=="请输入新密码"||this.value=="请再次输入新密码"  ){
				this.value="";
				//this.type="password";
			}
			if(this.value=="请输入找回密码的邮箱" ){
				this.value="";
			}
			});
		//修改密码
		$('.submit2').click(function(){
			$('.middle2').hide();
			$('.middle1').hide();
			$('.middle3').show();
			$.natureajax({
				type: "get",
				url:jsonserver+"community_modifyNaturePWD.do?",//获取JSON
				data:"callback=?&NP_INFO_ID="+natureid+"&Ukey="+ukey+"&NP_INFO_PWD="+$('#oldpassword').val()+"newPass="+$("#password1").val()+"&newPassSure="+$('#repassword1').val()+"",
				dataType:"jsonp",
				success:function(json){
					if(json[0].result==1){
						if(json[1].length>0){
							//地域进行遍历
							var _html='';
							for(i=0;i<json[1].length;i++){		
								var obj = json[1][i];
								if(i==0){
									_html +='<option  selected="selected"  value="'+obj.AREA_ID+'">'+obj.NAME+'</option>';
									}else{
										_html +='<option   value="'+obj.AREA_ID+'">'+obj.NAME+'</option>';
									}
							}
							$("#u48").append(_html);
						}
					}
				},
				error:function(){
					jAlert("抱歉，出错了",'注销',function(e){});
				}
				
			});
            
		 }); 	
			
		 }); 
		//window.open('tanchuang.html','','′location=no,scrollbars=no,resizable=no,height=100,width=300,top=100,left=100,status=no,menubar=no');
		</script>
        <link type="text/css" href="css/userInfo.css" rel="stylesheet" />
        <title>我的资料</title>
        <style>
		input {
			height: 50px;
			border-radius: 6px;
			font-size: 30px;
			border: 2px solid #EFEFEF;
			width: 60%;
		}
		
</style>
        </head>

        <body onresize="resize()">
        <div id="bodyobj" class="bigimg" style="overflow: hidden;">
         <div id="header" style="text-align:center;" class="header">
            <table class="headerTal">
              <tr>
                <td class="menuTd">返回</td>
                <td style="width:60%;">账户</td>
                <td></td>
              </tr>
            </table>
          </div>
          <div id="home1" style="background-color: white; width: 100%; "> 
            <!--页面主体开始-->
            <div class="topCenter">
              <div class="borderDiv">
                	<table class="table" style="color: #5F5F5F">
							<tr style="border-bottom: 1px solid black;height: 70px;">
								<td rowspan="5" style="width: 30%;background-color: #EFEFEF"><img src="image/mymessage_user.png"/></td>
								<td rowspan="5" style="width: 5px;"><img src="image/mymessage_iconbg.png"/></td>
								<td id="titleDesc">欢迎来到我的外快</td>
							</tr >
							<tr style="height: 10px;"><td ><div class="henxian"></div></td></tr>
							<tr style="height: 65px;">
								<td id="username1"></td>
							</tr>
							<tr style="height: 10px;"><td ><div class="henxian"></div></td></tr>
							<tr style="height: 65px;">
								<td id="phoneNumber"></td>
							</tr>
					</table>
              </div>
            </div>
            <div class="middle1">
              <div class="border1" >
                <div style="color: #565656;font-size: 30px;" id="diqu"> 请选择您所在地区：
                  <select id="u48" style="height: 40px;border-radius: 4px; font-size: 30px;border:1px solid #EFEFEF;padding-top: 5px;">
                  </select>
                </div>
                <div style="margin-top: 10px;color: #565656;font-size: 30px;"> 设置登录密码 </div>
                <div style="margin-top: 10px;color: #565656;font-size: 30px;"> 新密码：&nbsp;&nbsp;
                  <input id="password" type="password" placeholder="请输入新密码" maxlength="6"/>
                </div>
                <div style="margin-top: 10px;color: #EF4E16;font-size: 28px;margin-left: 20%"> 此密码与返佣账户密码一致！ </div>
                <div style="margin-top: 10px;color: #565656;font-size: 30px;">确认密码：
                  <input id="repassword" type="password" placeholder="请再次输入新密码" value="" maxlength="6"/>
                </div>
                <div style="margin-top: 10px;color: #565656;font-size: 30px;"> email：&nbsp;&nbsp;&nbsp;
                  <input id="email" type="text" placeholder="请输入找回密码的邮箱" value=""/>
                </div>
                <div class="okbtn"></div>
                <div class="xiaci" onclick="javascript :history.back(-1)"></div>
                <div style="height: 20px;"></div>
              </div>
              
            </div>
            <div class="middle2" >
              <div class="leftmima"></div>
              <div class="mima" >修改密码</div>
              <div style="height:  48px;"></div>
              <div class="jiumima">*旧密码： &nbsp;&nbsp;
                <input type="password" id="oldpassword" value=""/>
              </div>
              <div class="jiumima">*设定密码：
                <input type="password" id="password1" value=""/>
              </div>
              <div class="jiumima">*密码确认：
                <input type="password" id="repassword1" value=""/>
              </div>
              <div class="jinggao">密码为英文字母和数字混合，限定6位数</div>
              <div class="jiumima">*Email： &nbsp;&nbsp;
                <input type="text" />
              </div>
              <div class="submit2"></div>
            </div>
            <div class="middle3" >
              <table style="width: 100%">
                <tr>
                  <td style="width: 30%;"><img src="image/mysessage_03.png" style="margin-left: 20px;margin-top: 10px;"/></td>
                  <td style="width: 60%;"><div style="font-size: 38px;margin-top: 30px;" onclick="xiugai()">请补充账户信息</div></td>
                  <td style="width: 10%;"></td>
                </tr>
              </table>
            </div>
            <!--页面主体结束--> 
          </div>
          <div class="bottom" ></div>
        </div>
</body>
</html>